package alexanderHash.alxenderHashTests;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import alexanderHash.DynamicHash;
import alexanderHash.Hash;

public class DynamicHashTests {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
//		Hash myhash = new Hash(2);
		
//		 BufferedReader infile = new BufferedReader(new FileReader(args[0]));
//	        String lineRead = infile.readLine();
//	        String lastURL = "";
//	        
//	        while(lineRead != null) {																		
//	        	if((lineRead.length() >= 6 && lineRead.substring(0, 6).equals("*PAGE:")))
//	                lastURL = lineRead.substring(6);
//	            else																						
//	                myhash.put(lineRead, lastURL);
//
//	            lineRead = infile.readLine();
//	        }
//		System.out.println(myhash.getURLlist("IT"));
//		System.out.println(myhash.getURLs("IT"));
//		System.out.println("Contains word? " + myhash.contains("IT"));
//		System.out.println("Load factor: " + myhash.loadFactor());
//		myhash.printKeyValuePairs();
//		System.out.println("Number of elements: " + myhash.noElements());
//		myhash.put("", "");
		
		
		DynamicHash myNyhash = new DynamicHash();
		myNyhash.put("IT", "itu.dk/2");
		myNyhash.put("ITU", "itu.dk");
		myNyhash.printKeyValuePairs();
		
		System.out.println("IT = " + myNyhash.getURLs("IT"));
		System.out.println("ITU = " + myNyhash.getURLs("ITU"));
		System.out.println("\nnyHash elements = " + myNyhash.noElements());
		System.out.println("\nnyHash factor = " + myNyhash.loadFactor());
		
		myNyhash.resize();
		System.out.println("\nAfter resize\nnyHash elements = " + myNyhash.noElements());
		System.out.println("\nnyHash factor = " + myNyhash.loadFactor());

		
		//System.out.println("Aktuelt = " + myNyhash.getURLs("Aktuelt"));
	}

}
